#ifndef DEEPSEEKAPI_H
#define DEEPSEEKAPI_H

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>

class DeepSeekAPI : public QObject
{
    Q_OBJECT

public:
    static int s_Id;
    explicit DeepSeekAPI(QObject *parent = nullptr);
    void sendRequest(const QString &message, const QString &conversationId = "");

signals:
    void responseReceived(const QString &response, const QString &conversationId);
    void streamResponseStarted(const QString &chunk, const QString &conversationId);
    void streamResponseReasoningContent(const QString &chunk, const QString &conversationId);
    void streamResponseReceived(const QString &chunk, const QString &conversationId);
    void responseFinished(const QString &conversationId);
private slots:
    void onReplyFinished();
    void onReadyRead(); // 读取流式数据

private:
    QNetworkAccessManager *manager;
    QNetworkReply *streamReply;
    QMap<QString,QStringList> mapHistroy;
    QString curConversationId;
    QString responseText;
    QString apiKey; // 替换为你的 API 密钥
};

#endif // DEEPSEEKAPI_H
